home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / topmenu2.zip / MENU2DMO.BAS < prev    next >
BASIC Source File  |  1989-09-09  |  25KB  |  755 lines

  1. '========================================================================
  2. '  Documentation For:
  3. '                                 Top.Menu
  4. '                                Version 2.0
  5. '
  6. '    Written By:  Glenn Miller (Not The Band Leader)
  7. '                 Route 8 Box 492-A
  8. '                 Asheboro, North Carolina  27203
  9. '
  10. '            On:  September 5, 1989
  11. '
  12. '
  13. '    This Program is " ShareWare "  share it, abuse it, loose-it..etc...
  14. '
  15. '    BUT!...If you can use it...please register it by sending $15.00
  16. '    to me at the address above. Happy Trails!
  17. '
  18. '========================================================================
  19. '
  20. 'Top.Menu was created as an easy means to set up a menu operated system,
  21. 'without having to deal with passing "zillions" of varables to a subroutine.
  22. '
  23. 'It is in NO way intended to replace any of the fine utilities available
  24. 'but to be considered as a simpler (and less definable) substitute.
  25. '
  26. 'The following program "MENU2DMO" was written using Top.Menu so you can
  27. 'see how to setup your data for Top.Menu.
  28. '
  29. 'Okay..Enough of that..Now on to this....
  30. '
  31. '
  32. 'As you can see in the DECLARE statement on the 1st line of this program there
  33. 'are only 11 varables that need to be passed to the subroutine..
  34. '
  35. 'and here they are.....
  36. '
  37. '
  38. '  SEL   Returns containing the number of the selection that was selected.
  39. '
  40. '  SEL$  an arry of strings containing all the menu and submenu selections
  41. '        as well as the help line (line 25)
  42. '
  43. '  FGC ......... Fore Ground Color of the Menus (0-15)
  44. '
  45. '  BGC ......... Back Ground Color of the Menus (0-15)
  46. '
  47. '  HLC ......... High Lite Color of the Menus   (0-31)
  48. '
  49. '  Top.Line .... The Top starting Row Location of the Menu (0-24)
  50. '
  51. '  Dis.Time .... A switch to Turn the Time Display On (1=on)
  52. '                  Time is displayed in a 12 hr format with Am/Pm
  53. '
  54. '  Dis.Date .... A switch to Turn the Date Display On (1=on)
  55. '
  56. '  Scn.Blank ... A switch to enable Automatic Screen Blanking (1=on)
  57. '                  When enabled, the screen will turn off if no keys
  58. '                  are pressed within 3 minutes.
  59. '
  60. '  MSG$ ........ A string that will be centered on the Top Line of the Menu.
  61. '                  If MSG$=""  No Message is displayed on the top line.
  62. '
  63. '  BGC$ ........ The character thats used to clear the screen. (0-255)
  64. '              
  65. '
  66. '
  67. 'Heres the Details..........
  68. '
  69. 'This Menu system is a bar type with sub menus.
  70. 'There can be up to 9 selections per sub menu.
  71. 'There can be as many Selections on the Top Bar That you can fit on it
  72. 'and these DO NOT have to be the same length.
  73. '
  74. '
  75. 'The KEY to this menu system is the SEL$() array.
  76. '
  77. 'This array should be dimensioned as DIM SEL$(x,10) in the start of your
  78. 'program, Where x=number of Top Bar Selections you will have.
  79. '
  80. 'Array SEL$(x,0) needs to contain the Selection Names For the Top Bar.
  81. '
  82. 'Arrays SEL$(x,1) thru SEL$(x,9) contain the Selection Names For the
  83. 'sub menu under the SEL$(x,0) Name.
  84. '
  85. 'Array SEL$(x,10) needs to contain the HELP message that will be displayed
  86. 'on line 25. (if you want one.)
  87. '
  88. '
  89. 'Example:  To Set up a Selection called "DOS" and have 3 sub selections
  90. '          called:
  91. '
  92. '                 Exit To Dos
  93. '                 Shell To Dos
  94. '                 Enter Dos Commands
  95. '
  96. '         with a Help Message of:  What Do You Want!
  97. '
  98. 'The arrays would be:
  99. '
  100. '         SEL$(0,0)=" Dos "
  101. '         SEL$(0,1)=" Exit To Dos "
  102. '         SEL$(0,2)=" Shell To Dos "
  103. '         SEL$(0,3)=" Enter Dos Commands "
  104. '         SEL$(0,4)=""
  105. '         SEL$(0,10)="What Do You Want!"
  106. '
  107. '
  108. ' !!!!! NOTICE !!!!!
  109. '
  110. '       See How SEL$(0,4)=""
  111. '
  112. '       You MUST always define the next array AFTER the last one you want
  113. '       to use as "" (Nul), UNLESS the last one is number 9....
  114. '
  115. '       This makes it work right!..Okay..OK
  116. '
  117. '
  118. 'Define all the Selections you need by this method.
  119. 'Of course you will change to the next array..ie 1,2,3...etc. instead of 0.
  120. '
  121. '
  122. '
  123. 'Running Top.Menu ........
  124. '
  125. 'Once you have setup all the SEL$() your ready to go.
  126. '
  127. 'The Top Bar Selections can be selected by 2 different ways.....
  128. '
  129. ' 1 - Use The Left-Right cursor Keys to move to the desired selection.
  130. ' 2 - Press the Key of the 1st letter of a selection.
  131. '
  132. '     Note: If more than one selection has the same starting letter the
  133. '           program will move to the next selection when that same letter
  134. '           key is pressed again. I call this a "round-robin" display but I
  135. '           really dont know why.
  136. '
  137. '
  138. 'The Sub selections can be selected 2 different ways...
  139. '
  140. ' 1 - Use the Up-Down cursor keys to move to the desired selection and press
  141. '     the Enter Key.
  142. ' 2 - Enter the Number of the selection.(no enter key needed)
  143. '
  144. '
  145. '
  146. '
  147. 'What you get back for all your trouble........
  148. '
  149. 'The SEL variable returns to you with a number containing the Selection that
  150. 'was selected. (wheeeee...)
  151. '
  152. ' If the user pressed the "Esc" Key SEL will be -1. (neg.1)
  153. ' else heres what you get.
  154. '
  155. '
  156. ' The number is determined by: (Top Bar Selection Number *10) + selected sub#
  157. '
  158. 'Example:  If the user selected item# 5 from the first Top Bar selection the
  159. '          number would be: 5.
  160. '
  161. '          First Top Bar number = 0     SEL$(0,x)
  162. '
  163. '          0 * 10 = 0  + 5      = 5
  164. '
  165. '
  166. '    If item# 5 was selected from the 5th Top Bar the number would be: 45
  167. '
  168. '          5th  Top Bar Number  = 4    SEL$(4,x)
  169. '
  170. '          4 * 10 = 40 + 5      = 45
  171. '
  172. '
  173. '
  174. ' To include the Top.Menu routine Source Code in your Program;
  175. '
  176. ' 1st - Create/Load YOUR program into Qbasic.
  177. ' 2nd - Select "Merge..." under the "File" selection of Qbasic.
  178. ' 3rd - Select "TOPMENU2.BAS" as the File Name To Be Merged.
  179. '
  180. ' You should now be able to "View" Top.Menu by viewing the SUBs.
  181. '
  182. ' Example: You can Try this using the "MENU2DMO.bas".
  183. '
  184. ' 1.- Start Quickbasic
  185. ' 2.- Load in MENU2DMO.BAS (do not load the TOPMENU2.QLB library)
  186. ' 3.- Merge TOPMENU2.BAS
  187. ' 4.- The code is now included in MENU2DMO.BAS
  188. ' 5.- Select Top.Menu in "View" SUBs
  189. '
  190. '
  191. '
  192. ' Thats about it for now....so....
  193. ' Waiter!.....TOP.MENU......please!
  194. '========================================================================
  195.  
  196. DECLARE SUB Top.Menu (sel!, sel$(), fgc!, bgc!, hlc!, topline!, dis.time!, dis.date!, scn.blank!, msg$, bgc$)
  197.  
  198. DIM sel$(9, 10)                 'remember this?
  199.  
  200. '=======================================================================
  201. ' * * * * * * * * DEFINE SEL$() ARRAY WITH MENU DATA * * * * * * * * * *
  202. '=======================================================================
  203.  
  204. '=======================================================================
  205. 'Define Top Row Selection Names (x,0)
  206. '=======================================================================
  207. sel$(0, 0) = " Info "
  208. sel$(1, 0) = " Change "
  209. sel$(2, 0) = " Dos "
  210. sel$(3, 0) = " Set Time "
  211. sel$(4, 0) = " HELP! "
  212. sel$(5, 0) = " Set Date "
  213. sel$(6, 0) = " Quit "
  214. sel$(7, 0) = " Directory "
  215. sel$(8, 0) = " Files "
  216.  
  217. '=======================================================================
  218. 'Define Help Messages (x,10)
  219. '=======================================================================
  220. sel$(0, 10) = "Display Information About TOP.MENU"
  221. sel$(1, 10) = "Make Changes In TOP.MENU's Subroutine Program Variables"
  222. sel$(2, 10) = "Select The Dos Function You Want To Do"
  223. sel$(3, 10) = "Press ENTER To Set Time"
  224. sel$(4, 10) = "Press ENTER To Display Help"
  225. sel$(5, 10) = "Press ENTER To Set Date"
  226. sel$(6, 10) = "Press ENTER To Quit This Demo"
  227. sel$(7, 10) = "Select The Directory To Be Displayed"
  228. sel$(8, 10) = "Press ENTER To Display The Files and Description"
  229.  
  230. '=======================================================================
  231. 'Define Sub Selections For Top Selection 'INFO'
  232. '=======================================================================
  233. sel$(0, 1) = " About The Program "
  234. sel$(0, 2) = " How Its Used      "
  235. sel$(0, 3) = " Its' Heritage     "
  236. sel$(0, 4) = " HOW TO BUY IT!    "
  237. sel$(0, 5) = ""
  238.  
  239. '=======================================================================
  240. 'Define Sub Select